Image coding apparatus, image coding method, and program, and image decoding apparatus, image decoding method, and program

ABSTRACT

An image coding method for an image coding apparatus configured to divide an image into divisional blocks of a plurality of sizes and to perform coding on the image while controlling image quality according to a parameter value in units of divisional blocks includes acquiring a block size of a target block to be coded, acquiring a minimum block size used to control the parameter value, acquiring a state of division of the target block, acquiring the parameter value, determining whether the target block is divided according to the state of division of the target block, determining whether the block size of the target block is greater than or equal to the minimum block size;
         determining whether the block size of the target block is equal to the minimum block size, and coding the acquired parameter value.

TECHNICAL FIELD

The present invention relates to an image coding apparatus, image codingmethod, and program, and an image decoding apparatus, image decodingmethod, and program. In particular, the present invention relates to animage quality parameter coding method and decoding method pertaining tocalculation of an image quality parameter and insertion of code in imagecoding.

BACKGROUND ART

H.264/Moving Picture Experts Group (MPEG)-4 Advanced Video Coding (AVC),hereinafter referred to as H.264, has been known as a method ofcompression recording of a moving image. H.264 is widely used inone-segment digital terrestrial broadcasting and other applications.H.264 is characterized by the provision of a plurality of intraprediction capabilities, using integer transforms in units of 4×4 pixelsin addition to conventional coding schemes (see ISO/IEC 14496-10: 2004Information technology—Coding of audio-visual objects—Part 10: AdvancedVideo Coding, ITU-T H.264 Advanced video coding for generic audiovisualservices).

Coding schemes using an orthogonal transform and quantization, typifiedby MPEG-2 and H.264, perform an orthogonal transform and quantization onpredetermined block images to generate quantization coefficient data.For image quality control, the quantization is performed by using animage quality control parameter called quantization parameter.Specifically, quantization using a small quantization parameter valueproduces improved image quality but with a large amount of code.Quantization with a large quantization parameter value produces lowimage quality with a reduced amount of code. Optimum quantizationparameter values are selected for coding according to a target amount ofcode. Such control is referred to as rate control. Various rate controlmethods have been discussed, including TM5. After the quantization, thequantization coefficient data is subjected to variable-length coding togenerate coded coefficient data.

Quantization parameters are also coded to generate quantizationparameter code. For example, H.264 uses a difference value between aquantization parameter that is used to quantize a block preceding atarget block and a quantization parameter that is used to quantize thetarget block. The difference value is referred to as quantizationparameter delta (QP_DELTA). QP_DELTA calculated is coded into QP_DELTAcode by Golomb coding or arithmetic coding. For example, the QP_DELTAcode codec by Golomb coding produces one bit of code even if thedifference value is 0. The coded coefficient data and the quantizationparameter code thus generated are transmitted to a decoder. The decoderdecodes the coded coefficient data and the quantization parameter codeto generate quantization coefficient data and quantization parameters.The decoder then performs inverse quantization and an inverse orthogonaltransform on the quantization coefficient data by using the quantizationparameters, thereby generating a decoded image.

A single unit of processing in MPEG-2 and H.264 is called a macroblock.Macroblocks are lattice blocks of 16×16 pixels into which an image isdivided in a lattice pattern. In terms of pixels, blocks to beorthogonally transformed in MPEG-2 have a size of 8×8 pixels, and H.264a size of 8×8 pixels or 4×4 pixels. That is, a single macroblockincludes a plurality of orthogonal transform blocks. MPEG-2 and H.264can control (rate control) quantization parameters in units ofmacroblocks. Orthogonal transform blocks included in the same macroblockare quantized with the same quantization parameter. According to animproved technology of H.264, an image is divided in a lattice patterninto lattice blocks called largest coding tree blocks (LCTBs). An LCTBhas a size of 64×64 pixels. LCTBs are divided into blocks of smallersizes called coding tree blocks (CTBs) by using a region quadtreestructure. To search or input/output tree-structured data, the scanorder needs to be specified. A CTB includes orthogonal transform blockscalled transform units (TUs). TUs can also be divided into smaller sizesby using a region quadtree structure. Each unit has a division flag. Ablock having a division flag of true is structured to include fourdivisional blocks having a size ½ in height and width. A block having adivision flag of false includes no divisional block and contains actualdata on the block instead. In other words, only undivided TUs containcoefficient data on image blocks. An LCTB (lattice block) includes aplurality of hierarchically structured blocks of different orthogonaltransform sizes. Whether to divide a block can be determined by variousmethods. One of the determination methods is discussed in JapanesePatent Application Laid-Open No. 2005-191706, which includes usingLagrange multipliers to calculate block costs and selecting a blockdivision method of lower cost.

Suppose that an image coding method includes coding an image in units oflattice blocks into which the image is divided in a lattice pattern. Ifthe lattice blocks are large in size and image quality control isperformed in units of lattice blocks, boundaries between blocks ofdifferent image qualities may become noticeable.

Image quality parameters are coded and transmitted regardless of whetherthe image quality parameter changes. If lattice blocks are subdividedinto smaller units for image quality control, there is a problem ofoverhead caused by the image quality parameter code.

SUMMARY OF INVENTION

The present invention is directed to an image coding apparatus whichenables image quality control in units of appropriate blocks and canmake block boundaries smaller to generate an image where the boundariesare less noticeable.

According to an aspect of the present invention, an image codingapparatus configured to divide an image into divisional blocks of aplurality of sizes and to perform coding on the image while controllingimage quality according to a parameter value in units of divisionalblocks includes a unit configured to acquire a block size of a targetblock to be coded, a unit configured to acquire a minimum block sizeused to control the parameter value, a unit configured to acquire astate of division of the target block, a unit configured to acquire theparameter value, a unit configured to determine whether the target blockis divided according to the state of division of the target block, aunit configured to determine whether the block size of the target blockis greater than or equal to the minimum block size, a unit configured todetermine whether the block size of the target block is equal to theminimum block size, and a unit configured to code the acquired parametervalue.

According to an exemplary embodiment of the present invention, it ispossible to control image quality in units of appropriate blocks andmake block boundaries smaller to generate an image where the boundariesare less noticeable. Since image quality control parameter code need notbe inserted into all orthogonally transformed blocks, the amount ofquantization parameter code will not increase more than necessary.

Further features and aspects of the present invention will becomeapparent from the following detailed description of exemplaryembodiments with reference to the attached drawings.

BRIEF DESCRIPTION OF DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate exemplary embodiments, features,and aspects of the invention and, together with the description, serveto explain the principles of the invention.

FIG. 1 is a flowchart illustrating a method of coding an image qualityparameter according to a first exemplary embodiment of the presentinvention.

FIG. 2 is a flowchart illustrating a method of decoding an image qualityparameter according to a second exemplary embodiment of the presentinvention.

FIG. 3 is a flowchart illustrating a method of coding an image qualityparameter according to a third exemplary embodiment of the presentinvention.

FIG. 4 is a flowchart illustrating a method of decoding an image qualityparameter according to a fourth exemplary embodiment of the presentinvention.

FIG. 5 is a flowchart illustrating a method of coding an image qualityparameter according to a fifth exemplary embodiment of the presentinvention.

FIG. 6 is a flowchart illustrating a method of decoding an image qualityparameter according to a sixth exemplary embodiment of the presentinvention.

FIG. 7 is a diagram illustrating an example of a lattice block divided.

FIG. 8A is a diagram illustrating an example of division of a latticeblock and a division flag.

FIG. 8B is a diagram illustrating an example of division of a latticeblock and division flags.

FIG. 8C is a diagram illustrating an example of division of a latticeblock and division flags.

FIG. 8D is a diagram illustrating an example of division of a latticeblock and division flags.

FIG. 9 is a diagram illustrating an example of a hardware configurationfor performing a coding method and a decoding method according to anexemplary embodiment of the present invention.

FIG. 10 is a diagram illustrating an example of a hardware configurationfor performing a coding method according to an exemplary embodiment ofthe present invention.

FIG. 11 is a diagram illustrating an example of a hardware configurationfor performing a decoding method according to an exemplary embodiment ofthe present invention.

FIG. 12A is a diagram illustrating an example of image quality controlon divisional blocks.

FIG. 12B is a diagram illustrating an example of image quality controlon divisional blocks.

FIG. 12C is a diagram illustrating an example of image quality controlon divisional blocks.

FIG. 13 is a flowchart illustrating a method of coding processing on aframe.

FIG. 14 is a flowchart illustrating a method of decoding processing on aframe.

FIG. 15 is a diagram illustrating the data structure of a coded frame.

FIG. 16 is a diagram illustrating the data structure of coded data on alattice block.

FIG. 17 is a flowchart illustrating details of a method of codingdivisional blocks.

FIG. 18 is a flowchart illustrating details of a method of decodingdivisional blocks.

FIG. 19 is a flowchart illustrating a method of calculating an imagequality parameter according to the first exemplary embodiment.

FIG. 20 is a diagram illustrating divisional blocks to be accompanied byquantization parameters.

FIG. 21A is a diagram illustrating a relationship among a profile, alevel, and an image quality control minimum block size.

FIG. 21B is a diagram illustrating a relationship among a profile, alevel, and an image quality control minimum block size.

FIG. 22 is a flowchart illustrating a procedure for calculating an imagequality control minimum block size.

FIG. 23A is a diagram illustrating a structure of coded data of asequence.

FIG. 23B is a diagram illustrating a structure of coded data of asequence.

FIG. 24 is a flowchart illustrating an image coding method according toa seventh exemplary embodiment of the present invention.

FIG. 25 is a flowchart illustrating an image decoding method accordingto an eighth exemplary embodiment of the present invention.

DESCRIPTION OF EMBODIMENTS

Various exemplary embodiments, features, and aspects of the inventionwill be described in detail below with reference to the drawings.

A method of coding divisional blocks according to a first exemplaryembodiment of the present invention will be described with reference toFIGS. 1, 9, 13, 17, and 19.

FIG. 9 illustrates a configuration for executing a coding program thatincludes the method of coding according to the present exemplaryembodiment. The coding program is recorded on a hard disk device(hereinafter, abbreviated as HDD) 903. The coding program is loaded intoa random-access memory (RAM) 902 upon activation. A central processingunit (CPU) 901 performs the steps to be described below to perform imagecoding processing. In the present exemplary embodiment, input image datais stored in and read from the HDD 903. Output data is recorded on theHDD 903.

A coding operation of the foregoing configuration will be described.FIG. 13 is a flowchart illustrating a procedure for coding an entireframe. The present exemplary embodiment deals with a case where screensare each divided in a lattice pattern into lattice blocks of 64×64pixels and sequentially processed in units of lattice blocks. Latticeblocks within a screen are processed in a raster scan order. It shouldbe noted that the lattice block size is not limited to 64.

In step S1301, the CPU 901 sets an image quality control minimum blocksize. In step S1302, the CPU 901 codes the image quality control minimumblock size. In step S1303, the CPU 901 codes frame header information.In step S1304, the CPU 901 sets a first lattice block on the top left ofthe screen as a target lattice block. In step S1305, the CPU 901performs prediction processing on the target lattice block to generateresidual data. In step S1306, the CPU 901 performs a procedure forcoding residual data on the target lattice block. In step S1307, the CPU901 determines whether all lattice blocks in the frame are processed. Instep S1308, the CPU 901 sets the next lattice block as a target latticeblock.

The procedure of the steps will be described below. In step S1301, theCPU 901 sets a parameter called image quality control minimum blocksize. The present exemplary embodiment will be described on theassumption that image quality is controlled by a quantization parameterthat is used to quantize orthogonal transform coefficients. The imagequality control minimum block size is 16×16 pixels, so that imagequality control minimum block size information has a value of 16.However, the value is not limited to 16. The program developer may embeda fixed value in the program. The user may specify a value via a userinterface of the program. The program itself may calculate and set anoptimum value. The program may calculate optimum values depending oninput images. For example, if an input image is greater than 640×480pixels, the program may set the image quality control minimum block sizeto a value as large as 16. If resolution is lower than or equal to640×480 pixels, the program may set the image quality control minimumblock size to a value as small as 8.

In step S1302, the CPU 901 codes the image quality control minimum blocksize set in step S1301 to generate image quality control minimum blocksize code. For example, the CPU 901 may provide an index that expressesimage quality control minimum block size information of 64 as “0,” andsimilarly 32, 16, and 8 as “1,” “2,” and “3,” respectively. Then, theCPU 901 may generate a fixed-length code that represents the index.

In step S1303, the CPU 901 generates and codes frame header information.The CPU 901 includes the image quality control minimum block size codegenerated in step S1302 as a part of the frame header information. Notethat, while the present exemplary embodiment deals with the case wherethe image quality control minimum block size code is included in a frameheader, this is not restrictive. Image quality control minimum blocksize code may be included in a sequence, a picture, a slice, or a blockof highest hierarchical level.

In step S1304, the CPU 901 sets a lattice block on the top left of thescreen as a first target lattice block to be processed.

In step S1305, the CPU 901 generates a predicted image by usingintra-frame prediction and motion compensation prediction, and generatesresidual data from the pixels of the target lattice block. Theintra-frame prediction includes generating a predicted image byreferring to the vicinity of the target lattice block. The motioncompensation prediction includes generating a predicted image byreferring to pixels in other frames. Examples include intra predictionand motion compensation prediction that are adopted in the H.264 codingscheme mentioned previously. The CPU 901 codes an intra-frame predictionmode and/or motion vectors generated, and outputs the resultant to anoutput buffer as lattice block header information code.

In step S1306, the CPU 901 performs a procedure for coding residual datain a block, which will be described in conjunction with FIG. 17, on thetarget lattice block. FIG. 17 will be described in detail below.

In step S1307, the CPU 901 determines whether all lattice blocks in theframe are processed. If all the lattice blocks are processed (YES instep S1307), the CPU 901 ends the coding processing on the entire frame.If not all the lattice blocks are processed yet (NO in step S1307), theCPU 901 performs step S1308.

In step S1308, the CPU 901 sets the next lattice block in a raster scanorder as a target lattice block, and returns to step S1305.

FIG. 17 is a detailed flowchart of step S1306. In step S1306, the CPU901 codes a plurality of hierarchically structured orthogonal transformblocks of different sizes to generate coded data which includes imagequality control parameter code. Specifically, the CPU 901 performs blockdivision, an orthogonal transform, and quantization based on an imagequality control minimum block size, block size data, and residual dataon blocks. The flowchart also illustrates processing for codingdivisional blocks to generate block division flag code, codedcoefficient data, and QP_DELTA code pertaining to updating of an imagequality parameter. The present exemplary embodiment uses a regionquadtree structure for hierarchical structuring. Blocks at the highesthierarchical level are lattice blocks of 64×64 pixels. As the leveldescends by division processing, blocks of 32×32 pixels, 16×16 pixels,and as small as 8×8 pixels can be processed. The region quadtree-basedblock division structure can be transmitted to a decoder side by blockdivision flags being embedded in a stream.

In step S1700, the CPU 901 calculates costs when a target block isdivided and when not. In step S1701, the CPU 901 determines whether todivide the target block. In step S1702, the CPU 901 codes a blockdivision flag set as false and outputs the resultant. In step S1703, theCPU 901 performs a procedure for calculating an image quality parameter.In step S1704, the CPU 901 performs an orthogonal transform,quantization, and variable-length coding. In step S1705, the CPU 901performs a procedure for coding the image quality parameter. In stepS1706, the CPU 901 sorts coded data and outputs the resultant to anoutput buffer. In step S1707, the CPU 901 codes a block division flagset as true and outputs the resultant. In step S1708, the CPU 901performs the procedure for calculating an image quality parameter. Instep S1709, the CPU 901 performs the procedure for coding the imagequality parameter. In step S1710, the CPU 901 processes divisionalblocks included.

The procedure of the steps will be described below. In step S1700, theCPU 901 calculates costs when the block is divided and when not. Thecosts may be calculated by using Lagrange multipliers mentioned above,as well as image characteristics, statistics, and predicted codelengths.

In step S1701, the CPU 901 compares the costs with and without division,calculated in step S1700. If the cost with block division is lower thanthe cost without block division (YES in step S1701), the CPU 901determines the comparison to be true. If not (NO in step S1701), the CPU901 determines the comparison to be false. If the determination resultin step S1701 is false (NO in step S1701), the CPU 901 performs stepsS1702 to S1706. If the determination result in step S1701 is true (YESin step S1701), the CPU 901 performs steps S1707 to S1710.

Description will initially be given of the case where the cost is lowerwithout block division. In step S1702, the CPU 901 codes a blockdivision flag set as false. The CPU 901 typically assigns and codes,though not limited to, a one-bit value of 0.

In step S1703, the CPU 901 performs an image quality parametercalculation procedure illustrated in FIG. 19 to calculate an imagequality parameter. FIG. 19 will be described in detail below.

In step S1704, the CPU 901 performs an orthogonal transform,quantization, and variable-length coding on residual data to generatecoded coefficient data. The orthogonal transform is implemented by adiscrete cosine transform (DCT). The quantization is performed by usingthe image quality parameter calculated in step S1703. The CPU 901performs the quantization by using the same image quality parametervalue as that used for the previous quantization if no new image qualityparameter is calculated by the image quality parameter calculationprocedure illustrated in FIG. 19 to be described below. Forvariable-length coding, the CPU 901 may use Huffman coding andarithmetic coding. Such coding techniques can be implemented by usingmethods similar to those of H.264 mentioned previously.

In step S1705, the CPU 901 performs the image quality parameter codingprocedure. The image quality parameter coding procedure will bedescribed in detail below with reference to FIG. 1.

In step S1706, the CPU 901 sorts block division flag code, QP_DELTAcode, and coded coefficient data, and outputs the resultant to an outputbuffer in this order. If there is no coded data to output, the CPU 901only sorts and outputs existing coded data. FIG. 16 illustrates anexample of the code order.

Now, description will be given of the case where the cost is lower withblock division. In step S1707, the CPU 901 codes a block division flagset as true. The CPU 901 typically assigns and codes, though not limitedto, a one-bit value of 1.

In step S1708, the CPU 901 performs the image quality parametercalculation procedure illustrated in FIG. 19 to be described below,thereby calculating an image quality parameter.

In step S1709, the CPU 901 performs the image quality parameter codingprocedure as in step S1705. The image quality parameter coding procedurewill be described in detail below with reference to FIG. 1.

In step S1710, the CPU 901 recursively performs the present procedure onall divisional blocks included, i.e., four divisional blocks (upperleft, upper right, lower left, and lower right) that are included in thehierarchically subsequent level. The divisional blocks each have a size½ that of the original target block both in height and width. The targetblock size decreases division after division. The recursive processingmay be performed up to a block size as small as 8×8 pixels. By suchrecursive processing, a lattice block is successively divided into aregion quadtree structure. For example, suppose that a lattice block isdivided as illustrated in FIG. 7. A division flag for indicating thepresence or absence of block division will be denoted by 1 when acorresponding block is divided, and 0 when not. The division flags onthe respective divisional blocks are then expressed as illustrated inFIGS. 8A, 8B, 8C, and 8D. FIGS. 8A, 8B, 8C, and 8D illustrate the levelsand blocks of 64×64 pixels, 32×32 pixels, 16×16 pixels, and 8×8 pixels,respectively. The numerals indicate division flags. “−” indicates thatno flag is needed. The parenthesized numerals indicate structural order.In the present exemplary embodiment, the structural order refers to theorder of upper left, upper right, lower left, and lower right in termsof blocks. In terms of levels, the structural order refers to theforward order of scanning of the region quadtree structure. Sets ofdivision flag code, QP_DELTA code, and coded coefficient data are storedin the structural order. No division flag is set on blocks of 8×8 pixelssince such blocks will not be divided further. A block having a divisionflag of 1 contains no coefficient data itself since such a block issubdivided into divisional blocks of smaller size which containcoefficient data. As illustrated in FIG. 16 to be described below, astream has a data structure such that pieces of coded information onrespective divisional blocks are arranged in the structural order. Apiece of coded information on each divisional block includes a set ofdivision flag code, QP_DELTA code, and/or coefficient data on thedivisional block.

FIG. 1 is a detailed flowchart of the image quality parameter codingprocedure performed in steps S1705 and S1709. In step S101, the CPU 901acquires a target block size. In step S102, the CPU 901 acquires animage quality control minimum block size. In step S103, the CPU 901acquires the state of division of the block. In step S104, the CPU 901determines whether the target block is divided. In step S105, the CPU901 determines whether the target block size is greater than or equal tothe image quality control minimum block size. In step S106, the CPU 901determines whether the target block size is equal to the image qualitycontrol minimum block size. In step S107, the CPU 901 acquires an imagequality parameter. In step S108, the CPU 901 codes the image qualityparameter.

The procedure of the steps will be described below. In step S101, theCPU 901 acquires a target block size. Immediately after the presentprocedure is called from the procedure of FIG. 17, the target block tobe processed is a lattice block itself. The value of the target blocksize is thus 64. As the level of the region quadtree structure descendssubsequently due to recursive calls, the size value changes to 32, 16,and 8.

In step S102, the CPU 901 acquires an image quality control minimumblock size that is set from outside. In the present exemplaryembodiment, the value of the image quality control minimum block size is16. Whether the target block to code is divided has been determined insteps S1700 and S1701 of FIG. 17. In step S103, the CPU 901 acquiresdivision state information that indicates the result of divisiondetermination.

In step S104, the CPU 901 refers to the state of division of the targetblock acquired, and determines whether the target block is divided. Ifthe target block is divided (YES in step S104), the CPU 901 performsstep S106. If the target block is not divided (NO in step S104), the CPU901 performs step S105.

In step S105, the CPU 901 determines whether the target block size isgreater than or equal to the image quality control minimum block size.If the target block size is determined to be greater or equal (YES instep S105), the CPU 901 performs step S107 and the subsequent step. Ifnot (NO in step S105), the CPU 901 ends the image quality parametercoding processing.

In step S106, the CPU 901 determines whether the target block size isequal to the image quality control minimum block size. If the targetblock size is determined to be equal to the image quality controlminimum block size (YES in step S106), the CPU 901 performs steps S107and S108. If not (NO in step S108), the CPU 901 ends the image qualityparameter coding processing.

In step S107, the CPU 901 acquires an image quality parameter. The imagequality parameter is the one determined in step S1703 or S1708 of FIG.17. In step S108, the CPU 901 codes the image quality parameter. In thepresent exemplary embodiment, the CPU 901 determines a difference valuebetween the image quality parameter used to code the previous block andthe image quality parameter acquired in step S107 as a QP_DELTA value.The CPU 901 codes the determined QP_DELTA value by Golomb coding intoQP_DELTA code, which is image quality parameter code. In the presentexemplary embodiment, QP_DELTA is coded by Golomb coding. However, thisis not restrictive. QP_DELTA may be coded by arithmetic coding or othervariable length coding. The image quality parameter is used to calculatea next QP_DELTA value.

FIG. 19 is a detailed flowchart of the image quality parametercalculation procedure performed in steps S1703 and S1708.

In step S1901, the CPU 901 acquires a target block size. In step S1902,the CPU 901 acquires an image quality control minimum block size. Instep S1903, the CPU 901 acquires the state of division of the block. Instep S1904, the CPU 901 determines whether the target block is divided.In step S1905, the CPU 901 determines whether the target block size isgreater than or equal to the image quality control minimum block size.In step S1906, the CPU 901 determines whether the target block size isequal to the image quality control minimum block size. In step S1907,the CPU 901 calculates an image quality parameter.

The procedure of the steps will be described below. In step S1901, theCPU 901 acquires a target block size. Immediately after the presentprocedure is called from the procedure of FIG. 17, the target block tobe processed is a lattice block itself. The value of the target blocksize is thus 64. As the level of the region quadtree structure descendssubsequently due to recursive calls, the size value changes to 32, 16,and 8.

In step S1902, the CPU 901 acquires an image quality control minimumblock size that is set from outside. In the present exemplaryembodiment, the image quality control minimum block size is 16 in value.

Whether the target block to code is divided has been determined in stepsS1700 and S1701 of FIG. 17. In step S1903, the CPU 901 acquires divisionstate information that indicates the result of division determination.

In step S1904, the CPU 901 refers to the state of division of the targetblock acquired, and determines whether the target block is divided. Ifthe target block is divided (YES in step S1904), the CPU 901 performsstep S1906. If the target block is not divided (NO in step S1904), theCPU 901 performs step S1905.

In step S1905, the CPU 901 determines whether the target block size isgreater than or equal to the image quality control minimum block size.If the target block size is determined to be greater or equal (YES instep S1905), the CPU 901 performs step S1907. If not (NO in step S1905),the CPU 901 ends the image quality parameter calculation processing.

In step S1906, the CPU 901 determines whether the target block size isequal to the image quality control minimum block size. If the targetblock size is determined to be equal to the image quality controlminimum block size (YES in step S1906), the CPU 901 performs step S1907.If not (NO in step S1906), the CPU 901 ends the image quality parametercalculation processing.

In step S1907, the CPU 901 performs rate control processing to calculatean image quality parameter for coding the target block. For example, aswith TM5, the CPU 901 predicts the amount of code of the target blockand calculates an optimum quantization parameter. If the target block isdivided, all the divisional blocks included are subjected to the ratecontrol. The divisional blocks included are coded with the same imagequality parameter.

The coding method according to the present exemplary embodiment is usedto output data that has a data structure illustrated in FIGS. 15 and 16.Referring to FIG. 15, the frame header information includes the code ofthe image quality control minimum block size which is embedded in stepS1303 of FIG. 13. All the lattice blocks within the frame are undercontrol of the code. Referring to FIG. 16, a division flag on a latticeblock, or a block of 64×64 pixels, is followed by a division flag on anupper left block of 32×32 pixels in the subsequent level. If the blockof 32×32 pixels is not divided, the image quality parameter code orQP_DELTA code of that block follows, accompanied by the code ofcoefficient data on the residual of the 32×32 pixels. There follows adivision flag on an upper right block of 32×32 pixels. As said before,if a block of 32×32 pixels is divided into blocks of 16×16 pixels, adivision flag follows to indicate the state of division. If a block isnot divided further, QP_DELTA code and coefficient data code follow. Theimage quality control minimum block size is 16. If a block is dividedinto blocks smaller than 16×16 pixels, a division flag and coefficientdata code follow without QP_DELTA code added to the smaller blocks.

As described above, a target block size is compared with the imagequality control minimum block size, and whether to code a QP_DELTA valueis controlled depending on the comparison result. The provision of sucha mechanism enables image quality control in units of blocks into whichan image is divided in a lattice pattern. The image quality control canbe performed in finer units (FIG. 12C) than in a conventional case whereQP_DELTA code is embedded in units of lattice blocks (FIG. 12A). Thiscan narrow boundaries between blocks of different image qualities andmake differences in image quality less noticeable. In anotherconventional case, image quality control is performed and QP_DELTA codeis embedded in units of orthogonal transform blocks (FIG. 12B). Unlikesuch a case, the amount of code will not increase more than necessary,because the unit of image quality control can be selected and QP_DELTAcode need not be embedded in every orthogonal transform block. The imagequality parameter calculation procedure is performed only if the samecondition as that for inserting an image quality parameter holds. Thecalculation of the image quality parameter is thus also prevented fromincreasing more than unnecessary.

In the present exemplary embodiment, blocks are defined as squareblocks. It will be understood that blocks may be rectangular, such as8×4 pixels. While the region quadtree structure is scanned by usingrecursive processing, loop structures may be used to implement thescanning.

As illustrated in FIG. 10, the coding method according to the presentexemplary embodiment may be performed by a configuration that includesdedicated hardware such as an orthogonal transformer 1003, a quantizer1004, and a variable-length coder 1005. The CPU 1001 will not performthe orthogonal transform, quantization, and variable-length coding step,but makes the foregoing units perform the respective parts of theprocessing. In other respects, the procedure is the same as thatillustrated in FIG. 17.

The present exemplary embodiment has dealt with the case where codeddata is recorded on the HDD 903. However, this is not restrictive. Codeddata may be recorded on a recording medium other than the hard diskdevice 903. It will be appreciated that coded data may be transmitted toa communication circuit via a communication interface 905. An externalrecording device may be connected to record coded data on a portablemedium.

The present exemplary embodiment has also dealt with the case wheresoftware applications are recorded on the hard disk device 903. However,this is not restrictive. Software applications may be recorded on apiece of hardware such as a read-only memory (ROM). It will beappreciated that software applications may be recorded on a portablemedium such as a memory card and a disk.

The present exemplary embodiment has also dealt with the case where thenumber of times of division is coded to produce code that indicates thesize of an image quality control minimum block. However, this is notrestrictive. Since the maximum block size is that of a lattice block,the size of an image quality control minimum block may be expressed by a6-bit fixed length code. An image quality control minimum block is notlimited to a square configuration. Image quality control minimum blocksfor horizontal and vertical configurations may be provided separately.For example, horizontally or horizontally adjoining blocks may begrouped together, and image quality parameters may be controlled inunits of the block groups. In such a case, the sizes of image qualitycontrol minimum blocks may effectively be set for horizontal andvertical configurations separately.

An image decoding method according to a second exemplary embodiment ofthe present invention will be described with reference to FIGS. 2, 9,14, and 18.

FIG. 9 illustrates a configuration for executing a decoding program thatincludes the decoding method according to the present exemplaryembodiment. The recording program is recorded on the HDD 903. Thedecoding program is loaded into the RAM 902, and the CPU 901 performsthe steps of a procedure to be described below for decoding processing.Input coded data is read from the HDD 903. A decoded image is output toa display via an image output buffer which is provided in a video RAM(VRAM) 904. The CPU 901 performs the decoding processing block by block.Each block is decoded to produce a decoded image of the block, which iscopied to an appropriate position in a frame when output to the imageoutput buffer. When the decoding processing on blocks as much as asingle frame is completed, a frame of image is output to an outputbuffer. The following description will be given on the assumption thatthe input coded data is coded data that is generated in the firstexemplary embodiment.

FIG. 14 illustrates the procedure for decoding input coded data. Latticeblocks are decoded in a raster scan order. In step S1401, the CPU 901decodes and acquires frame header information. The present exemplaryembodiment deals with the case where the frame header informationincludes an image quality control minimum block size. However, this isnot restrictive. According to a predetermined data format, an imagequality control minimum block size may be acquired from headerinformation on a sequence, a picture, a slice, or a block of highesthierarchical level. In step S1402, the CPU 901 decodes and acquires animage quality control minimum block size. In step S1403, the CPU 901makes a setting so that the decoding result of the coded data is firststored into a first target lattice block. In step S1404, the CPU 901decodes the prediction mode of the target lattice block and generates apredicted image according to the prediction mode. In step S1405, the CPU901 performs a divisional block decoding procedure on the target latticeblock. In step S1406, the CPU 901 adds predicted image data and residualdata of the target lattice block, and outputs the resultant to the imageoutput buffer. In step S1407, the CPU 901 determines whether all latticeblocks in a frame are processed. In step S1408, the CPU 901 sets thenext lattice block as a target lattice block.

The procedure of the steps will be described below. In step S1401, theCPU 901 acquires a parameter called image quality control minimum blocksize from header information on a block that is of the highest order interms of sequences, pictures, frames, slices, and hierarchicalstructure.

In step S1402, the CPU 901 decodes and acquires the image qualitycontrol minimum block size. According to the first exemplary embodiment,the image quality control minimum block size is coded as an index. Theimage quality control minimum block size is 16. In step S1403, the CPU901 sets the lattice block on the top left of the screen as a targetlattice block.

In step S1404, the CPU 901 decodes coded data on the target latticeblock. The CPU 901 thereby decodes an intra-frame prediction mode and/ormotion vectors generated in the first exemplary embodiment. With intracoding, the CPU 901 refers to adjacent decoded pixels and generatespredicted image data based on the intra-frame prediction mode decoded.With inter coding, the CPU 901 performs motion compensation to generatepredicted image data based on the motion vectors.

In step S1405, the CPU 901 performs a divisional block decodingprocedure, which will be described below in conjunction with FIG. 18, onthe lattice block. Since the decoding of divisional blocks ishierarchically structured, the CPU 901 decodes division flags on blocksand determines the states of divisional blocks while performingdecoding. The CPU 901 thereby generates image quality parameters andresidual data with respect to predictions.

In step S1406, the CPU 901 adds the predicted image data generated instep S1404 and the residual data generated in step S1405 to generate adecoded image of the target lattice block. The CPU 901 outputs thedecoded image to the image output buffer.

In step S1407, the CPU 901 determines whether all the lattice blocks inthe frame are processed for decoding. For example, the CPU 901 countsthe number of lattice blocks decoded. If not all the lattice blocks areprocessed for decoding (NO in step S1407), the CPU 901 proceeds to stepS1408. If all the lattice blocks are decoded (YES in step S1407), theCPU 901 ends the decoding processing on the frame.

In step S1408, the CPU 901 sets the result of decoding that comes nextin a raster scan order as the next target lattice block.

FIG. 18 is a detailed flowchart of step S1405, illustrating a procedurefor decoding a plurality of hierarchically structured orthogonaltransform blocks of different sizes. Specifically, FIG. 18 illustrates aprocedure for performing variable-length decoding, an inverse orthogonaltransform, and inverse quantization on variable-length coded coefficientdata based on block division flag code and QP_DELTA code, to generateresidual data. The present exemplary embodiment uses a region quadtreestructure for hierarchical structuring. A block at the highest level(first target block to be processed) is a lattice block of 64×64 pixels.

In step S1801, the CPU 901 decodes a block division flag on the targetblock. In step S1802, the CPU 901 performs an image quality parameterdecoding procedure. In step S1803, the CPU 901 determines whether thetarget block to decode is divided. In step S1804, the CPU 901 performsvariable-length decoding, inverse quantization, and an inverseorthogonal transform. In step S1805, the CPU 901 recursively performsdecoding processing on divisional blocks included.

The procedure of the steps will be described below. In step S1801, theCPU 901 decodes a block division flag such as the one illustrated inFIG. 16 to acquire information as to whether the target block issubdivided. Decoding is performed according to a quadtree hierarchicalstructure. The CPU 901 can thereby acquire the state of division ofblocks.

In step S1802, the CPU 901 performs an image quality parameter decodingprocedure to be described below in conjunction with FIG. 2. The CPU 901thereby decodes an image quality parameter which is used in inversequantization for decoding the target block.

In step S1803, the CPU 901 refers to the decoded block division flag todetermine whether the target block is divided. If the target block isdetermined to be not divided (NO in step S1803), the CPU 901 performsstep S1804. If the target block is determined to be divided (YES in stepS1803), the CPU 901 performs step S1805.

In step S1804, the CPU 901 performs variable-length decoding, inversequantization, and an inverse orthogonal transform on coded coefficientdata of the target block, thereby generating residual data. Forvariable-length decoding, the CPU 901 performs decoding according to thecoding scheme used in the first exemplary embodiment. The CPU 901thereby acquires quantization coefficient data included in the block.For inverse quantization, the CPU 901 uses the image quality parameterdecoded in step S1802. If no new image quality parameter is decoded inS1802, the CPU 901 performs inverse quantization by simply using theimage quality parameter previously decoded. The CPU 901 performs aninverse orthogonal transform on the coefficient data resulting from theinverse quantization, thereby generating residual data.

In step S1805, the CPU 901 recursively performs the processing in stepsS1801 to S1805 as long as a block division flag decoded indicates thepresence of a hierarchically subsequent level. The CPU 901 therebyrestores residual data until the minimum divisional block size isreached.

Now, step S1802 intended for decoding an image quality parameter will bedescribed in detail with reference to FIG. 2.

FIG. 2 illustrates a procedure for decoding an image quality parameterof a plurality of hierarchically structured orthogonal transform blocksof different sizes. In step S201, the CPU 901 acquires a target blocksize. In step S202, the CPU 901 acquires an image quality controlminimum block size. In step S203, the CPU 901 acquires the state ofdivision of the block. In step S204, the CPU 901 determines whether thetarget block is divided. In step S205, the CPU 901 determines whetherthe target block size is greater than or equal to the image qualitycontrol minimum block size. In step S206, the CPU 901 determines whetherthe target block size is equal to the image quality control minimumblock size. In step S207, the CPU 901 decodes an image qualityparameter.

The procedure of the steps will be described below. In step S201, theCPU 901 acquires a target block size. Immediately after the presentprocedure is called from the procedure of FIG. 18, the target block tobe processed is a lattice block itself. The value of the target blocksize is thus 64. As division flags are decoded subsequently, the sizevalue changes to 32, 16, and 8 accordingly.

In step S202, the CPU 901 acquires an image quality control minimumblock size. In the present exemplary embodiment, the CPU 901 acquiresthe image quality control minimum block size decoded in step S1402 ofFIG. 14. In step S203, the CPU 901 acquires the state of division of theblock. In the present exemplary embodiment, the CPU 901 acquires theblock division flag decoded in step S1801 of FIG. 18.

In step S204, the CPU 901 determines the value of the block divisionflag. Using the same code assignment as that described in the firstexemplary embodiment, a block division flag having a value of “0”indicates that the block is not divided. A block division flag having avalue of “1” indicates that the block is divided. If the value of theblock division flag is “0” (NO in step S204), the CPU 901 performs stepS205. If the value is “1” (YES in step S204), the CPU 901 performs stepS206.

In step S205, the CPU 901 determines whether the target block size isgreater than or equal to the image quality control minimum block size.If the target block size is greater than or equal to the image qualitycontrol minimum block size (YES in step S205), the CPU 901 performs stepS207. If not (NO in step S205), the CPU 901 ends the processing.

In step S206, the CPU 901 determines whether the target block size isequal to the image quality control minimum block size. If the targetblock size is equal to the image quality control minimum block size (YESin step S206), the CPU 901 performs step S207. If not (NO in step S206),the CPU 901 ends the processing.

In step S207, the CPU 901 decodes image quality parameter code. In thepresent exemplary embodiment, the CPU 901 decodes QP_DELTA code into aQP_DELTA value by Golomb decoding. In the present exemplary embodiment,QP_DELTA is decoded by Golomb decoding. However, this is notrestrictive. QP_DELTA may be decoded by arithmetic decoding or othervariable length decoding depending on the predetermined data format. TheCPU 901 then adds the QP_DELTA value to the image quality parameter thatis used to code the previous block, thereby generating an image qualityparameter.

In the present exemplary embodiment, whether to decode an image qualityparameter is controlled depending on the same condition as that forcomparing the target block size in which the image quality parameter iscoded and the image quality control minimum block size. This enablesdecoding a stream that is generated by the coding method described inthe first exemplary embodiment.

As illustrated in FIG. 11, the decoding method according to the presentexemplary embodiment may be performed by a configuration that includesdedicated hardware such as an inverse orthogonal transformer 1103, aninverse quantizer 1104, and a variable-length decoder 1105, instead ofthe configuration illustrated in FIG. 9. The CPU 1101 will not performthe inverse orthogonal transform, inverse quantization, andvariable-length decoding step, but makes the foregoing units perform therespective parts of processing. In other respects, the procedure is thesame as that illustrated in FIG. 18.

The present exemplary embodiment has dealt with the case where codeddata is recorded on the hard disk device 903. However, this is notrestrictive. Coded data may be received from a communication circuit viaa communication interface 1006. An external recording device may beconnected to input coded data from a portable medium.

The present exemplary embodiment has also dealt with the case wheresoftware applications are recorded on the hard disk device 903. However,this is not restrictive. Software applications may be record on a pieceof hardware such as a read-only memory (ROM). It will be appreciatedthat software applications may be recorded on a portable medium such asa memory card and a disk.

A method of coding an image quality parameter according to a thirdexemplary embodiment of the present invention will be described withreference to FIG. 3. Unless otherwise specified, the configuration forperforming the coding method and the operation of the steps are the sameas in the first exemplary embodiment. In the present exemplaryembodiment, a block that includes a target block and has the same sizeas an image quality control minimum block size will be defined as animage quality control minimum block. Information that indicates whetheran image quality parameter is coded in an image quality control minimumblock will be defined as image quality parameter coding stateinformation. The image quality parameter coding state information isequivalent to information that indicates whether an image qualityparameter of the first divisional block in the image quality controlminimum block is coded.

FIG. 3 illustrates a procedure for coding an image quality parameter.FIG. 3 is a detailed flowchart of the image quality parameter codingprocedure to be performed in steps S1705 and S1709 of FIG. 17. Thisprocedure is performed instead of the image quality parameter codingprocedure illustrated in FIG. 1. In step S301, the CPU 901 acquiresimage quality parameter coding state information. In step S302, the CPU901 refers to the image quality parameter coding state information anddetermines whether an image quality parameter has already been coded inan image quality control minimum block.

The procedure of the steps will be described below. In step S104, likethe first exemplary embodiment, the CPU 901 refers to the state ofdivision of the target block acquired, i.e., whether the target block isfurther divided by a quadtree. If the target block is determined to bedivided (YES in step S104), the CPU 901 ends the processing unlike thefirst exemplary embodiment. If the target block is determined to be notdivided (NO in step S104), the CPU 901 performs step S105 like the firstexemplary embodiment.

In step S105, like the first exemplary embodiment, the CPU 901determines whether the target block size is greater than or equal to theimage quality control minimum block size. If the target block size isdetermined to be greater or equal (YES in step S105), the CPU 901performs steps S107 and S108 like the first exemplary embodiment. If not(NO in step S105), the CPU 901 performs the processing of steps S301 andS302.

In step S301, the CPU 901 acquires image quality parameter coding stateinformation. In the present exemplary embodiment, the image qualitycontrol minimum block size is 16. If the target block is an upper leftblock of 8×8 pixels, it follows that the CPU 901 acquires informationthat no image quality parameter is coded. If the target block is anupper right, lower left, or lower right block of 8×8 pixels, an imagequality parameter has already been coded in an upper left block of 8×8pixels. In such a case, the CPU 901 acquires information that an imagequality parameter is coded.

In step S302, the CPU 901 refers to the image quality parameter codingstate information and determines whether an image quality parameter hasalready been coded in the image quality control minimum block. If noimage quality parameter is determined to have been coded (NO in stepS302), the CPU 901 performs steps S107 and S108. If an image qualityparameter is determined to have been coded (YES in step S302), the CPU901 ends the image quality parameter coding processing.

A difference between the present exemplary embodiment and the firstexemplary embodiment will be described. In the first exemplaryembodiment, QP_DELTA code is embedded as data that accompanies a targetblock (a set of divisional blocks) if “the target block is divided andthe target block size is equal to the image quality control minimumblock size.” In the present exemplary embodiment, QP_DELTA code is addedto an upper left block, which is the first block in a target block, if“the target block is divided and the target block size is equal to theimage quality control minimum block size.” In the present exemplaryembodiment, the image quality control minimum block size is 16. Supposethat blocks divided as illustrated in FIG. 20 constitute a stream. Insuch a case, QP_DELTA code is inserted into immediately before pieces ofvariable-length coded coefficient data that correspond to the shadedblocks Nos. 0, 1, 7, 5, 6, 8, 9, 13, 14, and 15. In other words,QP_DELTA code accompanies blocks of 16×16 pixels or greater. If a blockof 16×16 pixels is divided, QP_DELTA code accompanies the upper leftblock of 8×8 pixels, i.e., the first subdivided block of the block of16×16 pixels.

The present exemplary embodiment can thus provide the same effects asthose of the first exemplary embodiment, whereas the procedures and datastructures have different concepts. In another possible configuration,no image quality parameter is coded unless quantization coefficientshave a non-zero value. If an upper left block in a target block includesno quantization coefficient of a non-zero value, an image qualityparameter is attached to a structurally subsequent first divisionalblock in which a quantization coefficient has a non-zero value. In stepS301 of the present exemplary embodiment, the CPU 901 calculates andacquires image quality parameter coding state information from the sizeand position of the target block to code. However, this is notrestrictive. For example, a flag may be provided that indicates whetheran image quality parameter is coded within an image quality controlminimum block size. The flag is reset each time the processing ofdividing an image quality control minimum block is performed, and seteach time an image quality parameter is coded. To acquire image qualityparameter coding state information, the CPU 901 refers to the flag. Ifthe flag is reset, the CPU 901 acquires information that no imagequality parameter is coded. If the flag is set, the CPU 901 acquiresinformation that an image quality parameter is coded.

A method of decoding an image quality parameter according to a fourthexemplary embodiment of the present invention will be described withreference to FIG. 4. Unless otherwise specified, the configuration forperforming the decoding method and the operation of the steps are thesame as in the second exemplary embodiment. In the present exemplaryembodiment, a block that includes a target block and has the same sizeas an image quality control minimum block size will be defined as animage quality control minimum block. Information that indicates whetheran image quality parameter is decoded in an image quality controlminimum block will be defined as image quality parameter decoding stateinformation.

FIG. 4 illustrates a procedure for decoding an image quality parameter.FIG. 4 is a detailed flowchart of the image quality parameter decodingprocedure to be performed in step S1802 of FIG. 18. This procedure isperformed instead of the image quality parameter decoding procedureillustrated in FIG. 2. In step S401, the CPU 901 acquires image qualityparameter decoding state information. In step S402, the CPU 901 refersto the image quality parameter decoding state information and determineswhether an image quality parameter has already been decoded in an imagequality control minimum block.

The procedure of the steps will be described below. In step S204, theCPU 901 determines the value of the block division flag. If the value ofthe block division flag is “0” which indicates that the block is notdivided (NO in step S204), the CPU 901 performs step S205 like thesecond exemplary embodiment. If the value of the block division flag is“1” which indicates that the block is divided (YES in step S204), theCPU 901 ends the image quality parameter decoding processing unlike thesecond exemplary embodiment.

In step S205, like the second exemplary embodiment, the CPU 901determines whether the target block size is greater than or equal to theimage quality control minimum block size. If the target block size isdetermined to be greater or equal (YES in step S205), the CPU 901proceeds to step S207. In step S207, the CPU 901 decodes an imagequality parameter like the second exemplary embodiment. If not (NO instep S205), the CPU 901 performs steps S401 and S402.

In step S401, the CPU 901 acquires image quality parameter decodingstate information. In the present exemplary embodiment, the imagequality control minimum block size is 16. If the target block is anupper left block of 8×8 pixels, it follows that the CPU 901 acquiresinformation that no image quality parameter is decoded. If the targetblock is an upper right, lower left, or lower right block of 8×8 pixels,an image quality parameter has already been decoded in an upper leftblock of 8×8 pixels. In such a case, the CPU 901 acquires informationthat an image quality parameter is decoded.

In step S402, the CPU 901 refers to the image quality parameter decodingstate information and determines whether an image quality parameter hasalready been decoded in the image quality control minimum block. If noimage quality parameter has been decoded (NO in step S402), the CPU 901performs step S207. If an image quality parameter has been decoded (YESin step S402), the CPU 901 ends the image quality parameter decodingprocessing.

In the present exemplary embodiment, whether to actually decode an imagequality parameter is controlled based on the condition for comparing atarget block size at which the image quality parameter is coded and theimage quality control minimum block size, and a determination conditionfor determining whether the image quality parameter has already beendecoded in the image quality control minimum block. Such a mode enablesdecoding a stream that is generated by the coding method described inthe third exemplary embodiment. The coding method may employ aconfiguration such that no image quality parameter is coded unlessquantization coefficients have a non-zero value. In such a case, thedecoding method may employ a similar configuration. If an upper leftblock in a target block includes no quantization coefficient of anon-zero value, an image quality parameter is decoded in a structurallysubsequent first divisional block in which a quantization coefficienthas a non-zero value.

In step S401 of FIG. 4 according to the present exemplary embodiment,the CPU 901 calculates and acquires image quality parameter decodingstate information from the size and position of the target block todecode. However, this is not restrictive. For example, a flag may beprovided that indicates whether an image quality parameter is decodedwithin an image quality control minimum block size. The flag is reseteach time the processing of dividing an image quality control minimumblock is performed, and set each time an image quality parameter isdecoded. To acquire image quality parameter decoding state information,the CPU 901 refers to the flag. If the flag is reset, the CPU 901acquires information that no image quality parameter is decoded. If theflag is set, the CPU 901 acquires information that an image qualityparameter is decoded.

A procedure for coding residual data in a block will be described withreference to FIG. 5. This procedure pertains to a method of coding animage quality parameter according to a fifth exemplary embodiment of thepresent invention. Unless otherwise specified, the configuration forperforming the coding method and the operation of the steps are the sameas in the first exemplary embodiment.

FIG. 5 illustrates a procedure for coding an image quality parameter andcoding residual data. The procedure implements the processingillustrated in FIGS. 17 and 1. This procedure is called from step S1306of FIG. 13. In step S501, the CPU 901 acquires a target block size. Instep S502, the CPU 901 acquires an image quality control minimum blocksize. In step S503, the CPU 901 calculates costs when the target blockis divided and when not, respectively. In step S504, the CPU 901determines whether to divide the target block. In step S505, the CPU 901outputs a block division flag set as false. In step S506, the CPU 901determines whether the target block size is greater than or equal to theimage quality control minimum block size. In step S507, the CPU 901calculates an image quality parameter. In step S508, the CPU 901performs a procedure for coding the image quality parameter. In stepS509, the CPU 901 performs prediction and performs an orthogonaltransform, quantization, and variable-length coding. In step S510, theCPU 901 outputs a block division flag set as true. In step S511, the CPU901 determines whether the target block size is equal to the imagequality control minimum block size. In step S512, the CPU 901 calculatesan image quality parameter. In step S513, the CPU 901 codes the imagequality parameter. In step S514, the CPU 901 processes divisional blocksincluded.

The processing procedure will be concretely described below. In stepS501, the CPU 901 acquires a target block size. Immediately after thepresent procedure is called from the procedure of FIG. 13, the targetblock to be processed is a lattice block itself. In the presentexemplary embodiment, the value of the target block size is, though notlimited to, 64. As the level of the region quadtree structure descendssubsequently due to recursive calls, the size value changes to 32, 16,and 8. Note that the number of levels is not limited thereto.

In step S502, the CPU 901 acquires an image quality control minimumblock size that is set from outside. In the present exemplaryembodiment, the value of the image quality control minimum block sizeis, though not limited to, 16.

In step S503, the CPU 901 calculates costs when the block is divided andwhen not, respectively. The costs are calculated by using Lagrangemultipliers mentioned above, as well as image characteristics,statistics, and predicted code lengths.

In step S504, the CPU 901 compares the costs with and without division,calculated in step S503. If the cost with block division is lower thanthe cost without block division (YES in step S504), the CPU 901 performssteps S510 to S514. If not (NO in step S504), the CPU 901 performs stepsS505 to S509.

In step S505, the CPU 901 outputs a block division flag set as false. Instep S506, the CPU 901 determines whether the target block size isgreater than or equal to the image quality control minimum block size.If the target block size is greater or equal (YES in step S506), the CPU901 performs steps S507 to S509. If not (NO in step S506), the CPU 901performs step S509 without performing steps S507 and S508.

In step S507, the CPU 901 performs rate control on the target block tocalculate an image quality parameter. In step S508, the CPU 901 codesthe image quality parameter calculated in step S507. In the presentexemplary embodiment, the CPU 901 determines a difference value betweenthe image quality parameter used in the previous block and the imagequality parameter calculated in step S507 as a QP_DELTA value. The CPU901 codes the determined QP_DELTA value by Golomb coding into QP_DELTAcode, which is image quality parameter code.

In step S509, the CPU 901 performs an orthogonal transform,quantization, and variable-length coding on residual data to generatecoded coefficient data. The CPU 901 performs the quantization by usingthe image quality parameter calculated in step S507. If in step S506 thetarget block size is determined to be smaller than the image qualitycontrol minimum block size (NO in step S506), the CPU 901 uses the sameimage quality parameter as that used for the previous quantization.

In step S510, the CPU 901 codes a block division flag set as true. Instep S511, the CPU 901 determines whether the target block size is equalto the image quality control minimum block size. If the target blocksize is equal to the image quality control minimum block size (YES instep S511), the CPU 901 performs steps S512 to S514. If not (NO in stepS511), the CPU 901 performs step S514 without performing steps S512 andS513.

In step S512, the CPU 901 performs rate control processing to calculatean image quality parameter for coding the target block with. Alldivisional blocks included are subjected to the rate control. Thedivisional blocks included are coded with the same image qualityparameter.

In step S513, the CPU 901 performs the same operation as in step S508 tocode the image quality parameter calculated in step S512. In step S514,the CPU 901 recursively performs the present procedure on fourdivisional blocks (upper left, upper right, lower left, and lower right)that are included in the hierarchically subsequent level. The divisionalblocks each have a size ½ that of the original target block both inheight and width. The target block size decreases division afterdivision. Such recursive processing can be performed up to a block sizeas small as 8×8 pixels. By the recursive processing, division flag code,QP_DELTA code, and coefficient data on respective divisional blocks areoutput as a stream in a structural order as illustrated in FIG. 16.

As described above, the rate control processing and the image qualityparameter coding processing may be integrated with each other. Even sucha configuration enables image quality control in finer units like themethod of coding an image quality parameter described in the thirdexemplary embodiment.

A method of decoding an image quality parameter according to a sixthexemplary embodiment of the present invention will be described withreference to FIG. 6.

FIG. 6 illustrates a procedure for decoding an image quality parameter.This procedure is applied to step S1405 of FIG. 14. In step S601, theCPU 901 acquires the size of a target block to decode. In step S602, theCPU 901 acquires an image quality control minimum block size. In stepS603, the CPU 901 decodes a block division flag. In step S604, the CPU901 determines whether the target block to decode is divided. In stepS605, the CPU 901 determines whether the target block size is greaterthan or equal to the image quality control minimum block size. In stepS606, the CPU 901 decodes an image quality parameter. In step S607, theCPU 901 performs variable-length decoding, inverse quantization, and aninverse orthogonal transform. In step S608, the CPU 901 determineswhether the target block size is equal to the image quality controlminimum block size. In step S609, the CPU 901 decodes an image qualityparameter. In step S610, the CPU 901 recursively calls the presentprocedure for decoding, targeted for divisional blocks included.

The procedure of the steps will be concretely described below. In stepS601, the CPU 901 acquires the size of a target block to decode.Immediately after the present procedure is called from the procedure ofFIG. 14, the target block to be processed is a lattice block itself. Inthe present exemplary embodiment, a lattice block has, though notlimited to, a size value of 64. As the level of the region quadtreestructure descends subsequently due to recursive calls, the size valuechanges to 32, 16, and 8. Note that the number of levels is not limitedthereto.

In step S602, the CPU 901 acquires an image quality control minimumblock size. In the present exemplary embodiment, the CPU 901 acquiresthe image quality control minimum block size that is embedded in frameheader information.

In step S603, the CPU 901 acquires the state of division of the block.In the present exemplary embodiment, the CPU 901 refers to the value ofthe block division flag that is decoded in step S1801 of FIG. 18.

In step S604, the CPU 901 determines whether the value of the blockdivision flag is true or false. If false (NO in step S604), the CPU 901performs steps S605 to S607. If true (YES in step S604), the CPU 901performs steps S608 to S610.

In step S605, the CPU 901 determines whether the target block size isgreater than or equal to the image quality control minimum block size.If the target block size is greater than or equal to the image qualitycontrol minimum block size (YES in step S605), the CPU 901 performssteps S606 and S607. If not (NO in step S605), the CPU 901 performs stepS607 without performing step S606.

In step S606, the CPU 901 decodes image quality parameter code. In thepresent exemplary embodiment, the CPU 901 decodes QP_DELTA code into aQP_DELTA value by Golomb decoding. The CPU 901 then adds the QP_DELTAvalue to an image quality parameter that is used in the previous inversequantization, thereby generating an image quality parameter.

In step S607, the CPU 901 performs variable-length decoding, inversequantization, and an inverse orthogonal transform. For inversequantization, the CPU 901 uses the image quality parameter decoded instep S606. If the target block size is smaller than the image qualitycontrol minimum block size (NO in step S608), the CPU 901 uses the imagequality parameter that is used to inversely quantize the previous targetblock. Subsequently, the CPU 901 ends the decoding of the target block.

In step S608, the CPU 901 determines whether the target block size isequal to the image quality control minimum block size. If the targetblock size is equal to the image quality control minimum block size (YESin step S608), the CPU 901 performs step S609. If not (NO in step S608),the CPU 901 proceeds to step S610 without performing step S609.

In step S609, the CPU 901 decodes image quality parameter code as instep S606. In step S610, the CPU 901 recursively performs the presentprocedure on four divisional blocks (upper left, upper right, lowerleft, and lower right) that are included in the hierarchicallysubsequent level. The divisional blocks each have a size ½ that of theoriginal target block both in height and width. The target block sizedecreases division after division. By such recursive processing, the CPU901 decodes division flag code, QP_DELTA code, and coefficient data oneach divisional block in the order of the region quadtree structure asillustrated in FIG. 16.

As described above, the recursive processing for scanning the regionquadtree structure and the image quality parameter decoding processingmay be integrated with each other. Even such a configuration can decodea stream that is coded by the coding method according to the firstexemplary embodiment or the fifth exemplary embodiment.

A seventh exemplary embodiment of the present invention deals with adivisional block coding method. The divisional block coding methodaccording to the present exemplary embodiment is implemented by usingthe configuration illustrated in FIG. 9.

Prior to coding, the CPU 901 sets a profile and a level. Profilesdescribe characteristics of a stream to be generated in the presentexemplary embodiment. Levels are a set of parameters that are allowabledepending on the processing performance of the decoder. Since processingperformance mainly depends on image size, levels are defined forrespective image sizes. However, the units of level definition are notlimited to image sizes. For example, levels may be set according to thenumber of lattice blocks to be processed because processing performancedepends on the number. In the present exemplary embodiment, imagequality control minimum block sizes are set to a minimum value in eachlevel. FIGS. 21A and 21B illustrate tables that define image qualitycontrol minimum block sizes limited by profile and by level.

The present exemplary embodiment deals with a case where the profilesinclude a baseline profile that uses only basic tools and a main profilethat uses other tools. However, the profiles are not limited thereto.

FIG. 21A illustrates a table that shows levels and the limits of imagequality control minimum block sizes in the baseline profile. FIG. 21Billustrates a table that shows levels and the limits of image qualitycontrol minimum block sizes in the main profile.

In the present exemplary embodiment, levels are classified by themaximum number of lattice blocks (64×64 pixels) included in a frame.Specifically, level 1 is intended for relatively small images such as640×480 pixels. Level 2 is intended for medium-sized images of 1920×1080pixels. Level 3 is intended for large images of 4096×2160 pixels. Itshould be noted that the number of levels and the level classificationsdo not limit the gist of the present invention.

The baseline profile illustrated in FIG. 21A will be described. Level 1shows that the minimum value of an image quality control minimum blocksize is 8 and image quality control minimum block sizes can be set inthe range of 8 to 64. Level 2 shows that the minimum value of an imagequality control minimum block size is 16 and image quality controlminimum block sizes can be set in the range of 16 to 64. Level 3 showsthat the minimum value of an image quality control minimum block size is32 and image quality control minimum block sizes can be set in the rangeof 32 to 64. The main profile illustrated in FIG. 21B shows that imagequality control minimum block sizes are controlled within the range of 8to 64 regardless of the level.

The CPU 901 determines the profile and level depending on conditions ofa coding method or apparatus, such as tools and memory capacities,and/or in consideration of conditions of a decoding method or apparatus.However, the method of determining the profile and level is not limitedin particular. A not-illustrated user may set a profile and a level. Thedetermined profile and level may be coded, included into a sequenceheader which describes information on an entire moving image, and outputfrom the communication interface 905. Such a profile and level may berecorded on the HDD 903.

Next, a procedure for coding frames will be described. In step S1301 ofFIG. 13, like the first exemplary embodiment, the CPU 901 initially setsa parameter of an image quality control minimum block size. FIG. 22 is aflowchart illustrating a method of calculating an image quality controlminimum block size. In step S2201, the CPU 901 determines a profiletype. If the profile type is a baseline profile (BASELINE PROFILE instep S2202), the CPU 901 performs step S2204 and subsequent steps. Ifthe profile type is a main profile (MAIN PROFILE in step S2202), the CPU901 performs step S2203.

The case with the main profile will be described first. In step S2203,the CPU 901 sets the image quality control minimum block size to 8. TheCPU 901 then ends the processing.

Next, the case with the baseline profile will be described. In stepS2204, the CPU 901 acquires a level value. In the present exemplaryembodiment, the level value is calculated according to an input imagesize. The level value indicates a minimum level at which a stream of theinput image size can be decoded.

In step S2205, the CPU 901 determines whether the level value is 1. Ifthe determination is true (YES in step S2205), the CPU 901 performs stepS2206. If the determination is false (NO in step S2205), the CPU 901performs step S2207. In step S2206, the CPU 901 sets the image qualitycontrol minimum block size to 8. In step S2207, the CPU 901 determineswhether the level value is 2. If the determination is true (YES in stepS2207), the CPU 901 performs step S2208. If the determination is false(NO in step S2207), the CPU 901 performs step S2209. In step S2208, theCPU 901 sets the image quality control minimum block size to 16. In stepS2209, the CPU 901 sets the image quality control minimum block size to32.

Then, the CPU 901 returns to the process illustrated in FIG. 13. In stepS1302, like the first exemplary embodiment, the CPU 901 codes the imagequality control minimum block size. In step S1303, the CPU 901 generatesframe header information including the coded data. FIG. 23A illustratesthe generated bit stream. A sequence header includes coded data on aprofile and a level, followed by codes that indicate image size. A frameheader in each piece of frame data includes image quality controlminimum block size code, with a size setting greater than or equal tothe minimum value of an image quality control minimum block size definedin FIG. 21A.

FIG. 24 is a flowchart illustrating an entire procedure. In step S2401,the CPU 901 inputs the size of an image to be coded. In step S2402, theCPU 901 selects a profile. The CPU 901 also selects a level according toFIG. 21A or 21B. In step S2403, the CPU 901 acquires the minimum valueof an image quality control minimum block size according to the selectedlevel. In step S2404, the CPU 901 codes the selected profile and level.In step S2405, the CPU 901 generates a sequence header including thecoded data on the profile and level. In step S2406, the CPU 901 performscoding in units of frames. Possible sizes of image quality controlminimum blocks in each frame are greater than or equal to the foregoingminimum value of an image quality control minimum block size. In stepS2407, the CPU 901 determines whether all frames are coded. If not allframes are coded (NO in step S2407), the CPU 901 proceeds to step S2406to code a next frame. If all frames are coded (YES in step S2407), theCPU 901 ends the coding processing.

The provision of profiles and levels and the limitation of image qualitycontrol minimum block sizes enable determination of image qualitycontrol minimum block sizes depending on image size. It is, therefore,possible to code an image while omitting operations in smaller blockswithout causing a decrease in image quality. This allows designing anoptimum circuit for an intended apparatus and designing a configurationfor suppressed certain power consumption. For example, a baselineprofile may be used for mobile communications, so that severe loadrestrictions can be imposed on coding operations in view of battery runtime. A main profile may be used for battery-less stationaryapparatuses, whereby looser restrictions are imposed on the operationload. In terms of software, operation time for performing quantizationcontrol in blocks smaller than image quality control minimum block sizescan be omitted for speedup.

It will be understood that a profile and level-based coding method, likethe present exemplary embodiment, may be applied to the third and fifthexemplary embodiments.

The minimum values of an image quality control minimum block sizedetermined for respective levels, illustrated in FIGS. 21A and 21B, mayalways be used in the respective levels. In such a case, image qualitycontrol minimum block size code to be included in each frame can beomitted. FIG. 23B illustrates such a bit stream. The bit streamillustrated in FIG. 23B differs from that illustrated in FIG. 23A inthat the frame headers include no image quality control minimum blocksize code. Image quality control minimum block sizes in the sequence arefixed to the minimum value of an image quality control minimum blocksize that is defined for the profile and level. This provides the effectof removing redundant code for improved coding efficiency.

Memory capacities for storing quantization matrices smaller than theimage quality control minimum block size and processing for updatingsuch quantization matrices can also be omitted.

An eighth exemplary embodiment of the present invention deals with animage decoding method for decoding a bit stream that is generated in theseventh exemplary embodiment. The image decoding method according to thepresent exemplary embodiment is implemented by using the configurationillustrated in FIG. 9.

Prior to decoding frames, the CPU 901 inputs and decodes a sequenceheader. The CPU 901 decodes code related to a profile and levelaccording to FIG. 23A. The CPU 901 also decodes image width code andimage height code. If the decoded profile is a baseline profile, the CPU901 refers to the table of FIG. 21A. The CPU 901 further selects anddetermines the minimum value of an image quality control minimum blocksize corresponding to the level. If the decoded profile is a mainprofile, the CPU 901 refers to the table of FIG. 21B and sets theminimum value of an image quality control minimum block size to 8.

At this point in time, the CPU 901 reserves buffers and other necessarymemories on the RAM 902. For example, with a baseline profile in level2, no image quality control will be performed in a block size of 8×8pixels. In such a case, memory areas for storing image qualityparameters in units of 8×8- and 4×4-pixel blocks may be omitted.

The CPU 901 decodes frames according to the flowchart of FIG. 14, whichhas been described in the second exemplary embodiment. In step S1402,the CPU 901 decodes an image quality control minimum block size includedin a frame header. In step S1405, the CPU 901 performs hierarchicaldecoding with a lattice block as a target block. In step S1805 of FIG.18 described in the second exemplary embodiment, the CPU 901 performsrecursive processing according to hierarchical levels, thereby decodingimage quality control parameters up to blocks of the image qualitycontrol minimum block size.

FIG. 25 is a flowchart illustrating an entire procedure. In step S2501,the CPU 901 inputs a sequence header. In step S2502, the CPU 901 decodescoded data on a profile and a level, thereby acquiring the profile andlevel. In step S2503, the CPU 901 acquires the minimum value of an imagequality control minimum block size according to the selected level. Instep S2504, the CPU 901 performs decoding in units of frames. Thisensures that possible sizes of image quality control minimum blocks ineach frame are greater than or equal to the foregoing minimum value ofan image quality control minimum block size. In step S2505, the CPU 901determines whether all frames are decoded. If not all frames are decoded(NO in step S2505), the CPU 901 proceeds to step S2504 to decode a nextframe. If all frames are decoded (YES in step S2505), the CPU 901 endsthe decoding processing.

The provision of profiles and levels and the limitation of image qualitycontrol minimum block sizes enable determination of image qualitycontrol minimum block sizes depending on image size. It is, therefore,possible to decode an image while omitting operations in smaller blockswithout causing a decrease in image quality. The determination of imagequality control minimum block sizes can reduce the number of times ofrecursive processing, whereby variations in time for performing decodingin units of lattice blocks can be suppressed.

Consequently, it is possible to design an optimum circuit for anintended apparatus and design a configuration for suppressed certainpower consumption. For example, a baseline profile may be used formobile communications, so that severe load restrictions can be imposedon coding operations in view of battery run time. A main profile may beused for battery-less stationary apparatuses, whereby looserrestrictions are imposed on the operation load. In terms of software,operation time for performing quantization control in blocks smallerthan image quality control minimum block sizes can be omitted forspeedup.

It will be understood that the CPU 901 may decode profile andlevel-related code according to FIG. 23B. As in the foregoingdescription, the CPU 901 inputs and decodes a sequence header. Accordingto the resulting profile and level, the CPU 901 determines an imagequality control minimum block size as described above. When decodingframes, the CPU 901 skips step S1402 and uses the image quality controlminimum block size.

The unique determination of an image quality control minimum block sizeaccording to the profile and level makes image decoding possible withoutimage quality control minimum block size code in each frame header.

The CPU 901 may compare a decoded image quality control minimum blocksize with an image quality control minimum block size that is determinedby the profile and level. If the latter is greater than the former, theCPU 901 may detect the bit stream for an error.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all modifications, equivalent structures, and functions.

This application claims priority from Japanese Patent Application No.2011-004648 filed Jan. 13, 2011, which is hereby incorporated byreference herein in its entirety.

1. An image encoding apparatus configured to divide an image intodivisional blocks and to perform encoding on the image in units ofdivisional blocks, the image coding apparatus comprising: an acquiringunit configured to acquire a block size of a target block to be encoded;a setting unit configured to set a block size of a quantization controlblock used to control a quantization of the image; an encoding unitconfigured to encode a quantization parameter corresponding to thetarget block to be encoded in a case where the block size acquired bythe acquiring.
 2. An image coding method for an image encoding apparatusconfigured to divide an image into divisional blocks of a plurality ofsizes and to perform encoding on the image while controlling imagequality according to a parameter value in units of divisional blocks,the image coding method comprising: acquiring a block size of a targetblock to be coded; acquiring a minimum block size used to control theparameter value; acquiring a divisional state of the target block;acquiring the parameter value; determining whether the target block isdivided according to the divisional state of the target block;determining whether the block size of the target block is greater thanor equal to the minimum block size; determining whether the block sizeof the target block is equal to the minimum block size; and coding theacquired parameter value.
 3. An image coding apparatus configured todivide an image into divisional blocks of a plurality of sizes and toperform coding on the image while controlling image quality according toa parameter value in units of divisional blocks, the image codingapparatus comprising: a unit configured to acquire a block size of atarget block to be encoded; a unit configured to acquire a minimum blocksize used to control the parameter value; a unit configured to acquire adivisional state of the target block; a unit configured to acquire theparameter value; a unit configured to determine whether the target blockis divided according to the divisional state of the target block; a unitconfigured to determine whether the block size of the target block isgreater than or equal to the minimum block size; a unit configured todetermine whether the block size of the target block is equal to theminimum block size; and a unit configured to code the acquired parametervalue.
 4. An image encoding method for an image coding apparatusconfigured to divide an image into divisional blocks and to performencoding on the image in units of divisional blocks, the image codingmethod comprising: acquiring a block size of a target block to beencoded; setting a block size of a quantization control block used tocontrol a quantization of the image; and encoding a quantizationparameter corresponding to the target block to be encoded in a casewhere the block size of a target block to be encoded is greater than orequal to the block size of a quantization control block, and encoding acommon quantization parameter for the quantization control block whichcontains the target block to be encoded in a case where the block sizeof a target block to be encoded is smaller than the block size of aquantization control block and the common quantization parameter has notbeen encoded.
 5. The image encoding apparatus according to claim 1,wherein the setting unit sets information indicating a block size of thequantization control block.
 6. The image encoding apparatus according toclaim 2, wherein the information is an index corresponding to a blocksize.
 7. The image encoding apparatus according to claim 1, wherein theacquiring unit acquires a block size of the target block by referring toa divisional state of the target block.
 8. The image encoding apparatusaccording to claim 1, wherein the encoding unit does not perform theencoding of the common quantization parameter in a case where the blocksize acquired by the acquiring unit is smaller than the block size setby the setting unit and the common quantization parameter has beenencoded.
 9. An image encoding apparatus configured to divide an imageinto divisional blocks and to perform encoding the image in units ofdivisional blocks, the image coding apparatus comprising: an acquiringunit configured to acquire a block size of a target block to be encoded;a setting unit configured to set a block size of a quantization controlblock used to control a quantization of the image; and an encoding unitconfigured to quantize the target block using the quantization parametercorresponding to the target block to be encoded in a case where theblock size acquired by the acquiring unit is greater than or equal tothe block size set by the setting unit, and to quantize the target blockusing a quantization parameter used for quantizing a block before thetarget block to be encoded in a case where the block size acquired bythe acquiring unit is smaller than the block size set by the settingunit and the common quantization parameter has not been encoded.
 10. Theimage encoding apparatus according to claim 9, further comprising: ablock size setting unit sets information indicating the plurality ofblock sizes, wherein the acquiring unit acquires the information, set bythe block size setting unit, of the target block to be encoded, and theencoding unit encodes a quantization parameter used for encoding of thetarget block in accordance with the information acquired by theacquiring unit.
 11. The image encoding apparatus according to claim 10,wherein the information indicating a plurality of block sizes is anindex corresponding to a block size.
 12. The image encoding apparatusaccording to claim 9, further comprising a determining unit configuredto determine a divisional state of the target block, wherein theencoding unit encodes the quantization parameter of the target block ina case where the target block has not been divided and the block sizeacquired by the acquiring unit is greater than or equal to the blocksize of the quantization control block set by the setting unit.
 13. Animage encoding apparatus configured to divide an image into divisionalblocks and to perform encoding on the image in units of divisionalblocks, the image coding apparatus comprising: a setting unit configuredto set an index corresponding to a block size of a target block to beencoded; an acquiring unit configured to acquire the index set by thesetting unit; a determining unit configured to determine whether acommon quantization parameter for a quantization control block whichcontains the target block has been encoded; and an encoding unitconfigured to encode a quantization parameter used for encoding of thetarget block to be encoded in accordance with a result of thedetermination by the determining unit and the index acquired by theacquiring unit, wherein the encoding unit encodes a quantizationparameter used for encoding of the target block to be encoded in a casewhere the determining unit determines that the common quantizationparameter has not been encoded and the index acquired by the acquiringunit satisfies a predetermined condition.
 14. An image decodingapparatus comprising: an acquiring unit configured to acquire a blocksize of a target block to be decoded; a setting unit configured to set ablock size of a quantization control block used to control aquantization of an image; and a decoding unit configured to decode aquantization parameter corresponding to the target block to be decodedin a case where the block size acquired by the acquiring unit is greaterthan or equal to the block size set by the setting unit, and to decode acommon quantization parameter for the quantization control block whichcontains the target block to be decoded in a case where the block sizeacquired by the acquiring unit is smaller than the block size set by thesetting unit and the common quantization parameter has not been decoded.15. The image decoding apparatus according to claim 14, wherein thesetting unit sets information indicating a block size of thequantization control block.
 16. The image decoding apparatus accordingto claim 15, wherein the information is an index corresponding to ablock size.
 17. The image decoding apparatus according to claim 14,wherein the acquiring unit acquires a block size of the target block byreferring to a divisional state of the target block.
 18. The imagedecoding apparatus according to claim 14, wherein the decoding unit doesnot perform the decoding of the common quantization parameter in a casewhere the block size acquired by the acquiring unit is smaller than theblock size set by the setting unit and the common quantization parameterhas been decoded.
 19. An image decoding apparatus comprising: anacquiring unit configured to acquire a block size of a target block tobe decoded; a setting unit configured to set a block size of aquantization control block used to control a quantization of the image;and a decoding unit configured to dequantize the target block using thequantization parameter corresponding to the target block to be decodedin a case where the block size acquired by the acquiring unit is greaterthan or equal to the block size set by the setting unit, and todequantize the target block using a quantization parameter used fordequantizing a block before the target block to be decoded in a casewhere the block size acquired by the acquiring unit is smaller than theblock size set by the setting unit and the common quantization parameterhas not been decoded.
 20. The image decoding apparatus according toclaim 19, further comprising: a block size setting unit sets informationindicating the plurality of block sizes, wherein the acquiring unitacquire the information, set by the block size setting unit, of thetarget block to be decoded, and the decoding unit decodes a quantizationparameter used for decoding of the target block in accordance with theinformation acquired by the acquiring unit.
 21. The image decodingapparatus according to claim 20, wherein the information indicating aplurality of block sizes is an index corresponding to a block size. 22.The image decoding apparatus according to claim 19, further comprising:a determining unit configured to determine a divisional state of thetarget block, wherein the decoding unit decodes the quantizationparameter of the target block in a case where the target block has notbeen divided and the block size acquired by the acquiring unit isgreater than or equal to the block size of the quantization controlblock set by the setting unit.
 23. An image decoding apparatuscomprising: a setting unit configured to set an index corresponding to ablock size of a target block to be decoded; an acquiring unit configuredto acquire the index set by the setting unit; a determining unitconfigured to determine whether a common quantization parameter for aquantization control block which contains the target block has beendecoded; and a decoding unit configured to decode a quantizationparameter used for encoding of the target block to be decoded inaccordance with a result of the determination by the determining unitand the index acquired by the acquiring unit, wherein the decoding unitdecodes a quantization parameter used for encoding of the target blockto be decoded in a case where the determining unit determines that thecommon quantization parameter has not been decoded and the indexacquired by the acquiring unit satisfies a predetermined condition. 24.An image decoding apparatus configured to perform decoding on an imageencoded with controlling image quality according to a parameter value inunits of divisional blocks, the image decoding apparatus comprising: aunit configured to acquire a block size of a target block to be decoded;a unit configured to acquire a minimum block size used to control theparameter value; a unit configured to acquire a divisional state of thetarget block; a unit configured to determine whether the target block isdivided according to the divisional state of the target block; a unitconfigured to determine whether the block size of the target block isgreater than or equal to the minimum block size; a unit configured todetermine whether the block size of the target block is equal to theminimum block size; and a unit configured to decode the parameter value.25. An image encoding method for an image encoding apparatus configuredto divide an image into divisional blocks and to perform encoding on theimage in units of divisional blocks, the image coding method comprising:acquiring a block size of a target block to be encoded; setting a blocksize of a quantization control block used to control a quantization ofthe image; and quantizing the target block using the quantizationparameter corresponding to the target block to be encoded in a casewhere the block size of a target block to be encoded is greater than orequal to the block size of a quantization control block, and quantizingthe target block using a quantization parameter used for quantizing ablock before the target block to be encoded in a case where the blocksize of a target block to be encoded is smaller than the block size of aquantization control block and the common quantization parameter has notbeen encoded.
 26. An image encoding method for an image encodingapparatus configured to divide an image into divisional blocks and toperform encoding on the image in units of divisional blocks, the imagecoding method comprising: setting an index corresponding to a block sizeof a target block to be encoded; acquiring the index; determiningwhether a common quantization parameter for a quantization control blockwhich contains the target block has been encoded; and encoding aquantization parameter used for encoding of the target block to beencoded in accordance with a result of the determination and the index,wherein the encoding encodes the quantization parameter used forencoding of the target block to be encoded in a case where it isdetermined that the common quantization parameter has not been encodedand the index satisfies a predetermined condition.
 27. An image decodingmethod for an image decoding apparatus comprising: acquiring a blocksize of a target block to be decoded; setting a block size of aquantization control block used to control a quantization of an image;and decoding a quantization parameter corresponding to the target blockto be decoded in a case where the block size of a target block to bedecoded is greater than or equal to the block size of a quantizationcontrol block, and decoding a common quantization parameter for thequantization control block which contains the target block to be decodedin a case where the block size of a target block to be decoded issmaller than the block size of a quantization control block and thecommon quantization parameter has not been decoded.
 28. An imagedecoding method for an image decoding apparatus comprising: acquiring ablock size of a target block to be decoded; setting a block size of aquantization control block used to control a quantization of the image;and dequantizing the target block using the quantization parametercorresponding to the target block to be decoded in a case where theblock size of a target block to be decoded is greater than or equal tothe block size of a quantization control block, and dequantizing thetarget block using a quantization parameter used for dequantizing ablock before the target block to be decoded in a case where the blocksize of a target block to be decoded is smaller than the block size setof a quantization control block and the common quantization parameterhas not been decoded.
 29. An image decoding method for an image decodingapparatus comprising: setting an index corresponding to a block size ofa target block to be decoded; acquiring the index; determining whether acommon quantization parameter for a quantization control block whichcontains the target block has been decoded; and decoding a quantizationparameter used for encoding of the target block to be decoded inaccordance with a result of the determination and the index, wherein thedecoding decodes a quantization parameter used for encoding of thetarget block to be decoded in a case where it is determined that thecommon quantization parameter has not been decoded and the indexsatisfies a predetermined condition.
 30. An image decoding method for animage decoding apparatus configured to perform decoding on an imageencoded with controlling image quality according to a parameter value inunits of divisional blocks, the image decoding method comprising:acquiring a block size of a target block to be decoded; acquiring aminimum block size used to control the parameter value; acquiring adivisional state of the target block; determining whether the targetblock is divided according to the divisional state of the target block;determining whether the block size of the target block is greater thanor equal to the minimum block size; determining whether the block sizeof the target block is equal to the minimum block size; and decoding theparameter value.
 31. A non-transitory computer-readable storage mediumwhich stores a computer program for causing a computer to execute themethod described in claim
 2. 32. A non-transitory computer-readablestorage medium which stores a computer program for causing a computer toexecute the method described in claim
 4. 33. A non-transitorycomputer-readable storage medium which stores a computer program forcausing a computer to execute the method described in claim
 24. 34. Anon-transitory computer-readable storage medium which stores a computerprogram for causing a computer to execute the method described in claim25.
 35. A non-transitory computer-readable storage medium which stores acomputer program for causing a computer to execute the method describedin claim
 27. 36. A non-transitory computer-readable storage medium whichstores a computer program for causing a computer to execute the methoddescribed in claim
 28. 37. A non-transitory computer-readable storagemedium which stores a computer program for causing a computer to executethe method described in claim
 29. 38. A non-transitory computer-readablestorage medium which stores a computer program for causing a computer toexecute the method described in claim 30.